/*
 *  region.h
 *  Untitled
 *
 *  Created by Ben Nolan on 2/11/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */
#pragma once

#include <map>
#include <vector>
#include "node.h"
#include "guid.h"
#include "axis_aligned_box.h"

namespace ticpp{ class Element; }

namespace Wonderland{
	typedef std::map<Wonderland::Guid, Wonderland::Node *> NodeMap;
	typedef std::pair<const Wonderland::Guid, Wonderland::Node *> NodeMapPair;
	
	class Region{
	public:
		Region(){
		}
		
		~Region();

		std::vector<Node*> findNodesWithin(const AxisAlignedBox);
		bool hasNode(const Guid);
		void deleteNode(const Guid);

		void addNode(Node*);
		Node* getNode(const Guid);
		
		void save(std::string filename);
		void load(std::string filename);

	protected:
		Wonderland::AxisAlignedBox bounds_;
		NodeMap nodes_;
		NodeMap dirtyNodes_;
	
	private:
		ticpp::Element* toXml();
		std::string toString();
	};

}

